<template>
    <h1>企业入驻审核</h1>
    <div class="container">
        <el-table :data="types" border style="width: 100%" locale="zhCn">
            <el-table-column type="index" label="序号" width="180" />
            <el-table-column prop="username" label="企业名" />
            <el-table-column prop="create_time" label="提交时间" />
            <el-table-column label="操作" width="200">
                <template #default="scope">
                    <el-button
                        type="primary"
                        @click="verify('1', scope.row.id)"
                    >
                        通过
                    </el-button>
                    <el-button type="danger" @click="verify('0', scope.row.id)">
                        不通过
                    </el-button>
                </template>
            </el-table-column>
        </el-table>
    </div>
</template>
<script setup lang="ts">
import request from '@/api';
import { Type } from '@/types';
import { ElMessage } from 'element-plus';
import { ref } from 'vue';
const typeName = ref('');
const selectId = ref(0);
// 类型
const types = ref<Array<any>>([]);
// 列表请求
request.get('/getVerifyList').then(res => {
    types.value = res.data;
});

const verify = async (status: '1' | '0', id: number) => {
    await request({
        method: 'post',
        url: '/verify',
        data: {
            status,
            userId: id,
        },
    });
    ElMessage.success('操作成功');
    request.get('/getVerifyList').then(res => {
        types.value = res.data;
    });
};
</script>
<style scoped lang="less"></style>
